mui.init({
	swipeBack: true //启用右滑关闭功能
});
mui.plusReady(function() {
	var state = app.getState();
	var uid = state.user_id;
	var getUrl = apiurl + "chat/getRoomList/?&user_id=" + uid;

	mui.getJSON(getUrl, function(res) {
		//console.log(JSON.stringify(res.list));
		document.querySelector("#list-area").innerHTML = template('list-templete', {
			"list": res.list
		});
	});
	var list = document.getElementById('list-area');
	list.style.height = (document.body.offsetHeight - 110) + 'px';
	mui("#list-area").on('tap', 'a', function() {
		var name = this.getAttribute('roomname');
		//var name = this.getAttribute('roomname');
		var id = this.getAttribute('roomid');
		mui.openWindow({
			url: '/pages/chat/chat_index.html',
			id: '/pages/chat/chat_index.html',

			show: {
				autoShow: true,
				aniShow: 'slide-in-right',
				duration: 100
			},
			waiting: {
				autoShow: true,
				title: 'waiting...'
			},
			extras: {
				chatHeader: "../../static/images/qun.png",
				chatTitle: name,
				roomId: id,
				roomType: 2
			}
		});
	});
});